'use strict';

module.exports = app => {
  const { router, controller } = app;
  const adminauth = app.middleware.adminauth();
  router.post('/admin/login', controller.admin.index.login);
  router.get('/admin/logout', controller.admin.index.logout);
  router.post('/admin/addArticle', adminauth, controller.admin.index.addArticle);
  router.get('/admin/getArticleList/:type_id/:status', adminauth, controller.admin.index.getArticleList);
  router.get('/admin/getArticleDetail/:id', adminauth, controller.admin.index.getArticleDetail);
  router.put('/admin/updateArticle', adminauth, controller.admin.index.updateArticle);
  router.delete('/admin/delArticleById', adminauth, controller.admin.index.delArticleById);


  router.get('/admin/getTypeList', adminauth, controller.admin.index.getTypeList);
  router.get('/admin/getTypeListInfo', adminauth, controller.admin.index.getTypeListInfo);
  router.post('/admin/addType', adminauth, controller.admin.index.addType);

  router.get('/admin/articleAddTime', adminauth, controller.admin.index.articleAddTime);
  router.get('/admin/visitCount', adminauth, controller.admin.index.visitCount);
};
